package StrategyMode.version6;


import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by ycq on 2018/10/19.
 */
public class CashContext {
    //先声明一个CashSuper对象
    CashSuper cs=null;


    //这里的参数是正常，满减，返利
    public CashContext(){
        switch(Form1_load()){
            case "正常":
                cs=new  CashNormal();
                break;
            case "返利":
                cs=new  CashReturn() ;
                break;
            case "打折":
                cs=new  CashRebate();
                break;
        }
    }

    public Double GetResult(Double money){
        return  cs.acceptCash(money);
    }

    private static  String  Form1_load(){
        Scanner in =new Scanner(System.in);
        ArrayList arrayList=new ArrayList();
        arrayList.add("正常0");
        arrayList.add("返利1");
        arrayList.add("打折2");
        System.out.println(arrayList);
        System.out.println("请输入以上字符");
        return in.next();
    }

}
